﻿package mortal.game.view.platform.platformTencent
{
    import mortal.game.mvc.*;
    import mortal.game.resource.*;
    import mortal.game.view.common.*;

    public class PlatformTencentIcon extends ActionBaseIcon
    {
        private var _iconType:int;
        private var _iconState:int;
        private static var _instance:PlatformTencentIcon;
        public static const type_QQYellow:int = 0;
        public static const type_QQBlue:int = 1;
        public static const state_Normal:int = 0;
        public static const state_Reward:int = 1;
        public static const resNameArr:Array = [[ResFileConst.PlatformTencentVipIcon, ResFileConst.PlatformTencentVipIcon], [ResFileConst.QQBlueVipIcon2, ResFileConst.QQBlueVipIcon1]];

        public function PlatformTencentIcon(param1:String)
        {
            super(param1);
            return;
        }// end function

        public function set textNumber(param1:int) : void
        {
            if (param1 == 0)
            {
                setIconTxt("");
            }
            else
            {
                setIconTxt(param1.toString());
            }
            return;
        }// end function

        override protected function createDisposedChildrenImpl() : void
        {
            super.createDisposedChildrenImpl();
            disEventName = EventName.PlatformTencentShow;
            this.name = "PlatformTencentIcon";
            return;
        }// end function

        override public function playEffect(param1:String = "ActionIconEffect.swf") : void
        {
            super.playEffect(param1);
            return;
        }// end function

        override public function get width() : Number
        {
            return 56;
        }// end function

        override public function get height() : Number
        {
            return 54;
        }// end function

        public function showIcon(param1:int, param2:int) : void
        {
            this._iconType = param1;
            this._iconState = param2;
            btn.styleName = resNameArr[param1][param2] as String;
            btn.toolTipData = PlatformTencentUtil.getLanZuanTips;
            btn.drawNow();
            if (!isViewShow())
            {
                show();
            }
            return;
        }// end function

        public function setState(param1:int) : void
        {
            this._iconState = param1;
            btn.styleName = resNameArr[this._iconType][param1] as String;
            btn.drawNow();
            return;
        }// end function

        public static function get instance() : PlatformTencentIcon
        {
            if (!_instance)
            {
                _instance = new PlatformTencentIcon(ResFileConst.PlatformTencentVipIcon);
            }
            return _instance;
        }// end function

        public static function hasInstance() : Boolean
        {
            return _instance != null;
        }// end function

        public static function isViewShow() : Boolean
        {
            return hasInstance() && !instance.isHide;
        }// end function

    }
}
